﻿using SUNRPA.CONTROLS.IMPL.domain.attrubutes;
using SUNRPA.CONTROLS.IMPL.domain.flowRunningVar;
using SUNRPA.CONTROLS.IMPL.util;
using System.Collections.Concurrent;

namespace SUNRPA.CONTROLS.IMPL.domain.flowItemParam {
    [Serializable]
    [VarFieldName("OutVarName")]
    public class DateTime2TextNParam:BaseParam {
        private string dateObj = "{Date}";
        //0年-月-日，1年-月，2月-日,3年，4，月，5日
        private int formatType = 0;
        private string separator = "-";
        private string outVarName = "dateString";
        public string GetTranslateFormatType() {
            switch(this.formatType) {
                case 0:
                    return $"年{separator}月{separator}日";
                case 1:
                    return $"年{separator}月";
                case 2:
                    return $"月{separator}日";
                case 3:
                    return $"年";
                case 4:
                    return $"月";
                case 5:
                    return $"日";
                default : 
                    return $"年{separator}月{separator}日";
            }
        }
        public string OutVarName {
            get => outVarName; 
            set { 
                outVarName = value;
                NotifyPropertyChanged("OutVarName");
            }  
        }
        public string DateObj {
            get => dateObj; 
            set { 
                dateObj = value;
                NotifyPropertyChanged("DateObj");
            }  
        }
        public int FormatType {
            get => formatType; 
            set { 
                formatType = value;
                NotifyPropertyChanged("FormatType");
            }  
        }
        public string Separator {
            get => separator; 
            set { 
                separator = value;
                NotifyPropertyChanged("Separator");
            }  
        }

        public override void SetLatestVarName(ConcurrentDictionary<string, ConcurrentDictionary<string, RPAVariableDefineWrapper>> globleData) {
            this.outVarName = this.GetLatestName(this.outVarName, globleData);
        }
    }
}
